package com.day02;

import com.day01.Type;

import java.util.ArrayList;
import java.util.HashMap;

/**
 * @Author liuyuan
 * @Date 2022/11/7 10:04 AM
 * @Version 1.0
 */
public class jihe {
    public static void main(String[] args) {
        //集合就是数组封装(在原先数组的基础上加了很多功能给我使用从而提高我们的开发效率)
        //创建一个ArrayList集合
        ArrayList<Dog> arr1 = new ArrayList<>();
        Dog dog1 = new Dog();
        dog1.setColor("红色");
        dog1.setHeight(180);
        dog1.setWeight(120);
        dog1.setName("大红");
        dog1.setType(Type.DAHUANG);
        dog1.setType1("DAHUANG");
        Dog dog2 = new Dog();
        dog2.setColor("黄色");
        dog2.setHeight(120);
        dog2.setWeight(110);
        dog2.setName("大黄");
        Dog dog3 = new Dog();
        dog3.setColor("pink");
        dog3.setHeight(180);
        dog3.setWeight(120);
        dog3.setName("粉色回忆");
        dog3.setType(Type.HASHIQI);
        dog3.setType1("HASHIQI");
        arr1.add(dog1);
        arr1.add(dog2);
        arr1.add(dog3);
        System.out.println(arr1);
        System.out.println("---------表达式-----------");
         arr1.forEach(e->{
             System.out.println(e);
         });
        System.out.println("---------foreach-----------");
        for (Dog a:arr1) {
            System.out.println(a);
        }
        System.out.println("--------------------");
        HashMap<String, Dog> map = new HashMap<>();
        map.put("red",dog1);
        map.put("yellow",dog2);
        map.put("pink",dog3);
        Dog dog = map.get("pink");
        System.out.println(dog);



    }
}
